package com.stefanini.pe.bbva.bp.in.report;

import java.awt.Color;
import java.util.List;

import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.data.general.DefaultPieDataset;

public class PieRenderer extends BarRenderer{

	private static final long serialVersionUID = 8395056811318408535L;
	
	private Color[] color;
    
    public PieRenderer(Color[] color){
        this.color = color;
    }       
   
    public void setColor(PiePlot plot, DefaultPieDataset dataset){
        List<Comparable> keys = dataset.getKeys();
        int aInt;
       
        for (int i = 0; i < keys.size(); i++){
            aInt = i % this.color.length;
            plot.setSectionPaint(keys.get(i), this.color[aInt]);
        }
    }

}
